<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<script type="text/javascript" src="./js3.js"></script>
<head>
<meta http-equiv="Content-Type" content="textml; charset=utf-8" />
<title></title>
<style>
</style>
<script type="text/javascript">
window.onload=function (){

	var odn1=document.getElementById('h1');
	var odn2=document.getElementById('h2');
	var odn3=document.getElementById('h3');
	var adiv=document.getElementById('div1');
	var inp=adiv.getElementsByTagName('input');
	odn1.onclick=function(){
		for(var i=0;i<inp.length;i++)
		{

           inp[i].checked=true;
		}
	};
	odn2.onclick=function(){
		for(var i=0;i<inp.length;i++)
		{

           inp[i].checked=false;
		}
	};
    odn3.onclick=function(){
		for(var i=0;i<inp.length;i++)
		{
           if(inp[i].checked==false)
           inp[i].checked=true;
           else
       	    inp[i].checked=false;
		}
	};


};	
</script>
</head>
<body>
<input type="button" value="全选" id="h1"/>
<input type="button" value="不选" id="h2"/>
<input type="button" value="反选" id="h3"/><br/>
<div id="div1">
<input type="checkbox"><br/>
<input type="checkbox"><br/>
<input type="checkbox"><br/>
<input type="checkbox"><br/>
<input type="checkbox"><br/>
<input type="checkbox"><br/>
<input type="checkbox"><br/>
</div>
</body>
</html>
